package com.p2p.backend.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import com.p2p.base.dao.BaseMapper;

/**
 * leiwen@yiqihao.com
 */
public interface UserRoleDao extends BaseMapper {

	@Insert("replace into p2p_user_role(user_id,role_id) values (#{user_id},#{role_id})")
	void add(Map<String, Object> params);

	@Insert("update p2p_user_role set role_id=#{role_id} where user_id=#{user_id}")
	
	void update(Map<String, Object> params);
	
	@Select("select * from p2p_user_role where user_id=#{userId} limit 0,1")
	Map<String, Object> get(Integer userId);

	@Select("select * from p2p_user_role where role_id=#{roleId}")
	List<Map<String, Object>> getByRole(Integer roleId);

}
